package univer.oko.report;


/**
 * @author Eduard Dudar
 *         DATE: 10.04.2005
 *         Copyright 2005
 */
public class HTMLStringFormatter {
    public static final String BOLD = "BOLD";
    public static final String ITALIC = "ITALIC";
    public static final String BOLD_ITALIC = "BOLD-ITALIC";
    public static final String UNDERLINE = "UNDERLINE";
    public static final String BOLD_UNDERLINE = "BOLD-UNDERLINE";

    public static final String LEFT = "LEFT";
    public static final String CENTER = "CENTER";
    public static final String RIGHT = "RIGHT";


    public static String format(String str, String style) {
        String temp = "";
        if (style.equals(HTMLStringFormatter.BOLD)) {
            temp = temp + "<B>" + str + "</B>";
        } else if (style.equals(HTMLStringFormatter.ITALIC)) {
            temp = temp + "<I>" + str + "</I>";
        } else if (style.equals(HTMLStringFormatter.BOLD_ITALIC)) {
            temp = temp + "<I><B>" + str + "</B></I>";
        } else if (style.equals(HTMLStringFormatter.UNDERLINE)) {
            temp = temp + "<U>" + str + "</U>";
        } else if (style.equals(HTMLStringFormatter.BOLD_UNDERLINE)) {
            temp = temp + "<U><B>" + str + "</B></U>";
        } else {
            temp = temp + str;
        }

        return temp;
    }


    public static String format(String str, String style, String align) {
        String temp = format(str, style);

        if (align.equals(HTMLStringFormatter.LEFT)) {
            temp = "<LEFT>" + temp + "</LEFT>";
        } else if (align.equals(HTMLStringFormatter.CENTER)) {
            temp = "<CENTER>" + temp + "</CENTER>";
        } else if (align.equals(HTMLStringFormatter.RIGHT)) {
            temp = "<RIGHT>" + temp + "</RIGHT>";
        } else {
            temp += str;
        }

        return temp;
    }
}